// Decompiled by GOOSIN CO,LTD Copyright 2010 Pavel Kouznetsov.
// home page: http://www.Goosin.net
// Decompiler options: packimports(3) fieldsfirst ansi space 
// Source File Name:   ColumnMain.java

package include.ecommerce;

import include.nseer_db.nseer_db;
import java.sql.ResultSet;

public class ColumnMain
{

	private nseer_db db;

	public ColumnMain()
	{
	}

	public String[] getColumn(String dbname, String unit, String column_name)
	{
		String cols[] = new String[1];
		try
		{
			db = new nseer_db(dbname);
			int amount = 0;
			int i = 0;
			String sql = (new StringBuilder("select count(id) from ")).append(column_name).append(" where unit_id='").append(unit).append("'").toString();
			ResultSet rs = db.executeQuery(sql);
			if (rs.next())
				amount = rs.getInt("count(id)");
			cols = new String[amount];
			sql = (new StringBuilder("select first_kind_name from ")).append(column_name).append(" where unit_id='").append(unit).append("' order by id").toString();
			for (rs = db.executeQuery(sql); rs.next();)
			{
				cols[i] = rs.getString("first_kind_name");
				i++;
			}

			db.close();
		}
		catch (Exception ex)
		{
			ex.printStackTrace();
		}
		return cols;
	}
}
